package com.liyiqing.commonservice.vo;

import com.baomidou.mybatisplus.annotation.TableLogic;
import com.liyiqing.commonservice.validator.ListValue;
import com.liyiqing.commonservice.validator.methodgroup.AddGroup;
import com.liyiqing.commonservice.validator.methodgroup.DeleteGroup;
import com.liyiqing.commonservice.validator.methodgroup.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;


/**
 * 商品的详细信息
 */
@Data
public class ProductDetailVo implements Serializable {
    private static final long serialVersionUID = 1L;


    /**
     * 商品id
     */
    @Null(message = "新增时不可指定商品id",groups = {AddGroup.class})
    @NotNull(message = "修改或删除时必须指定商品id",groups = {UpdateGroup.class, DeleteGroup.class})
    private Long id;
    /**
     * 卖家账号id(谁卖的)
     */
    @NotNull(message = "新增时必须指定卖家账号id",groups = {AddGroup.class})
    private Long memberId;
    /**
     * 商品名称
     */
    @NotBlank(message = "商品名称不能为空",groups = {AddGroup.class})
    private String name;
    /**
     * 商品描述
     */
    @NotBlank(message = "商品描述不能为空",groups = {AddGroup.class})
    private String description;
    /**
     * 所属的二级分类id
     */
    @NotNull(message = "新增时必须指定商品二级分类id",groups = {AddGroup.class})
    private Long groupId;
    /**
     * 单价
     */
    @NotNull(message = "商品单价不能为空",groups = {AddGroup.class})
    private BigDecimal price;
    /**
     * 销售量
     */
    private Long saleCount;
    /**
     * 库存量
     */
    @NotNull(message = "库存量不能为空",groups = {AddGroup.class})
    private Long stockCount;


    /**
     * 商品图片的id
     */
    private List<Long> imagesId;

    /**
     * 商品的图片路径
     */
    private List<String> imagesUrl;


    /**
     * 商品信息更新时间
     */
    private String updateTime;


    /**
     * 上架状态[0：下架，1：上架]
     */
    @TableLogic(value="1",delval="0")
    @ListValue(values = {0,1},message = "账号状态只能是:【1(上架)】or【0(下架)】")
    private Integer publishStatus;


}
